cargo.git
10 years agoAuto merge of #1733 - wackywendell:project-layout, r=steveklabnik
bors [Fri, 19 Jun 2015 16:38:59 +0000 (16:38 +0000)]
Auto merge of #1733 - wackywendell:project-layout, r=steveklabnik

I have several times found myself trying to remember where to put examples, and getting frustrated looking for it in the guide - because its not there, its in the manifest description, which I find to be a non-intuitive place for it. I thought it might help to unify the project layout sections between "The Guide" and "Manifest Description", and have them both link to each other for explanations where needed.

Of course, I am very willing to take any suggestions on my changes; I'm not wedded to any of text in specific, I just want the two sections to not be so separate and hard to find, especially from each other.

10 years agoReturn guide and manifest to original format, but with additional info
Wendell Smith [Fri, 19 Jun 2015 13:15:37 +0000 (09:15 -0400)]
Return guide and manifest to original format, but with additional info

This puts the main "Project Layout" section back into `manifest.md` as it was
before, but adds a bit more detail to that section both those pages and a link
between them.

10 years agoMoved and expanded project layout
Wendell Smith [Thu, 18 Jun 2015 15:57:35 +0000 (11:57 -0400)]
Moved and expanded project layout

10 years agoAuto merge of #1730 - alexcrichton:update-docopt, r=alexcrichton
bors [Wed, 17 Jun 2015 22:56:29 +0000 (22:56 +0000)]
Auto merge of #1730 - alexcrichton:update-docopt, r=alexcrichton

Closes #1720

10 years agoUpdate docopt to fix some option parsing
Alex Crichton [Wed, 17 Jun 2015 22:55:16 +0000 (15:55 -0700)]
Update docopt to fix some option parsing

Closes #1720

10 years agoAuto merge of #1712 - alexcrichton:run-cargo-on-stable, r=brson
bors [Wed, 17 Jun 2015 05:32:17 +0000 (05:32 +0000)]
Auto merge of #1712 - alexcrichton:run-cargo-on-stable, r=brson

This commit moves Cargo onto 100% stable Rust now that the necessary fs features
have been stabilized. The tests were updated to understand when they're running
with a non-nightly compiler and disable all plugin-related tests. The only major
feature here is that the calls to `fs::set_file_times` were reimplemented
manually in the tests that Cargo has.

Cargo still requires a *nightly compiler* due to the stable features not having
made their way into the stable channel yet, but it will soon work on all of the
stable, beta, and nightly compilers once 1.1 is released!

10 years agoMove Cargo onto stable Rust
Alex Crichton [Sat, 13 Jun 2015 00:37:19 +0000 (17:37 -0700)]
Move Cargo onto stable Rust

This commit moves Cargo onto 100% stable Rust now that the necessary fs features
have been stabilized. The tests were updated to understand when they're running
with a non-nightly compiler and disable all plugin-related tests. The only major
feature here is that the calls to `fs::set_file_times` were reimplemented
manually in the tests that Cargo has.

Cargo still requires a *nightly compiler* due to the stable features not having
made their way into the stable channel yet, but it will soon work on all of the
stable, beta, and nightly compilers once 1.1 is released!

10 years agoAuto merge of #1715 - iliekturtles:nightly-stable, r=wycats
bors [Mon, 15 Jun 2015 00:10:05 +0000 (00:10 +0000)]
Auto merge of #1715 - iliekturtles:nightly-stable, r=wycats

Change references to the current stable Rust. Also correct Windows
install links to point to the new .msi installers.

I totally removed the nightly paragraph from the FAQ as I couldn't think of anything to replace it with.

10 years agoRemove references to prefering nightly Rust.
Mike Boutin [Mon, 15 Jun 2015 00:04:44 +0000 (20:04 -0400)]
Remove references to prefering nightly Rust.

Change references to the current stable Rust. Also correct Windows
install links to point to the new .msi installers.

10 years agoAuto merge of #1714 - alexcrichton:default-feature-oscillating, r=huonw
bors [Sun, 14 Jun 2015 20:24:01 +0000 (20:24 +0000)]
Auto merge of #1714 - alexcrichton:default-feature-oscillating, r=huonw

There was previously a bug in resolve where turning off the default set of
features would cause resolve to not correctly settle on the set of features
activated for a package. If one dependency turned off all features, and then the
next dependency to be activated only turned on the default feature, the default
feature wouldn't actually end up getting activated.

This commit alters the check to see if the package has been previously activated
to more rigorously check to see if the 'default' feature is activated
previously. If a dependency doesn't use the default feature, or if the package
itself does not have the feature "default", then the package is considered
activated, but otherwise it needs to go through another cycle of resolution.

10 years agoFix resolution with `default-features = false`
Alex Crichton [Sun, 14 Jun 2015 18:16:46 +0000 (11:16 -0700)]
Fix resolution with `default-features = false`

There was previously a bug in resolve where turning off the default set of
features would cause resolve to not correctly settle on the set of features
activated for a package. If one dependency turned off all features, and then the
next dependency to be activated only turned on the default feature, the default
feature wouldn't actually end up getting activated.

This commit alters the check to see if the package has been previously activated
to more rigorously check to see if the 'default' feature is activated
previously. If a dependency doesn't use the default feature, or if the package
itself does not have the feature "default", then the package is considered
activated, but otherwise it needs to go through another cycle of resolution.

10 years agoAuto merge of #1713 - eerden:zsh-autocompletion-testnames-fix, r=alexcrichton
bors [Sun, 14 Jun 2015 04:18:48 +0000 (04:18 +0000)]
Auto merge of #1713 - eerden:zsh-autocompletion-testnames-fix, r=alexcrichton

Fixes #1703

10 years agoDisable package completion
Ercan Erden [Sat, 13 Jun 2015 23:02:17 +0000 (19:02 -0400)]
Disable package completion

10 years agoFix bench name completion
Ercan Erden [Sat, 13 Jun 2015 22:54:34 +0000 (18:54 -0400)]
Fix bench name completion

10 years agoImprove autocompletion of test items
Ercan Erden [Sat, 13 Jun 2015 20:34:14 +0000 (16:34 -0400)]
Improve autocompletion of test items

Test item autocompletion didn't work because it required the name of the
test to come immediately after [[test]] line. This commit should fix
that.

10 years agoFix wrong auto completion for update --precise
Ercan Erden [Sat, 13 Jun 2015 20:36:34 +0000 (16:36 -0400)]
Fix wrong auto completion for update --precise

--precise argument for the update command was fed test names. This
commit prevents autocompletion of --precise.

10 years agoFix error causing test name completion failure
Ercan Erden [Sat, 13 Jun 2015 19:51:49 +0000 (15:51 -0400)]
Fix error causing test name completion failure

This was caused by a syntax error.

10 years agoAuto merge of #1709 - alexcrichton:fix-some-overrides, r=brson
bors [Fri, 12 Jun 2015 22:12:14 +0000 (22:12 +0000)]
Auto merge of #1709 - alexcrichton:fix-some-overrides, r=brson

The fix in #1697 was to alter the `Hash` implementation of `Package` to take
into account the source root instead of just the package id (so packages at the
same source would have the same hash). There's a spot, however, where we
normalize some paths and not others, causing two paths which logically point the
same location end up having different hashes, so the same package ended up being
stored multiple times, later leading to an assertion that there was only one
stored.

This commit alters the behavior of read_packages to keep a hash map of ID =>
Package instead of just a hash set of Package as the deduplication/equality
needs to be based on the ID, not the literal path to the source root.

This specific bug shows up when you have an override and a normal dependency
pointing at the same location (and the override has some inter-dependencies).
Not exactly a normal use case, but it showed up in Servo's build!

10 years agoDon't rely on Hash for Package deduplicating
Alex Crichton [Fri, 12 Jun 2015 22:03:15 +0000 (15:03 -0700)]
Don't rely on Hash for Package deduplicating

The fix in #1697 was to alter the `Hash` implementation of `Package` to take
into account the source root instead of just the package id (so packages at the
same source would have the same hash). There's a spot, however, where we
normalize some paths and not others, causing two paths which logically point the
same location end up having different hashes, so the same package ended up being
stored multiple times, later leading to an assertion that there was only one
stored.

This commit alters the behavior of read_packages to keep a hash map of ID =>
Package instead of just a hash set of Package as the deduplication/equality
needs to be based on the ID, not the literal path to the source root.

This specific bug shows up when you have an override and a normal dependency
pointing at the same location (and the override has some inter-dependencies).
Not exactly a normal use case, but it showed up in Servo's build!

10 years agoAuto merge of #1701 - alexcrichton:lenient-rustc-flags, r=brson
bors [Fri, 12 Jun 2015 18:36:01 +0000 (18:36 +0000)]
Auto merge of #1701 - alexcrichton:lenient-rustc-flags, r=brson

Some flags to the compiler could cause it to stop early or not emit some files
altogether (or perhaps emit files in different locations even). Currently cargo
expects a few outputs of the compiler after `cargo rustc` is run, but this
commit alters cargo to know that when `cargo rustc` is being run that the
outputs may not exist and that's ok.

Closes #1675

10 years agoAuto merge of #1705 - alexcrichton:fix-test-non-root-package, r=brson
bors [Fri, 12 Jun 2015 00:18:15 +0000 (00:18 +0000)]
Auto merge of #1705 - alexcrichton:fix-test-non-root-package, r=brson

The previous overhaul of how dependencies among build dependencies were
traversed ended up picking the wrong root package when the `-p` argument was
specified to commands. This commit fixes this up by making sure the right root
package is passed along.

10 years agoAuto merge of #1704 - JustAPerson:doc_codegen_units, r=alexcrichton
bors [Thu, 11 Jun 2015 16:41:56 +0000 (16:41 +0000)]
Auto merge of #1704 - JustAPerson:doc_codegen_units, r=alexcrichton

Closes #1691

10 years agoFix testing the non-root package
Alex Crichton [Thu, 11 Jun 2015 07:24:05 +0000 (00:24 -0700)]
Fix testing the non-root package

The previous overhaul of how dependencies among build dependencies were
traversed ended up picking the wrong root package when the `-p` argument was
specified to commands. This commit fixes this up by making sure the right root
package is passed along.

10 years agoDocument the `codegen-units` manifest option
Jason Priest [Thu, 11 Jun 2015 01:53:34 +0000 (20:53 -0500)]
Document the `codegen-units` manifest option

Closes #1691

10 years agoAuto merge of #1702 - alexcrichton:fix-traverse-build-deps, r=brson
bors [Wed, 10 Jun 2015 17:28:45 +0000 (17:28 +0000)]
Auto merge of #1702 - alexcrichton:fix-traverse-build-deps, r=brson

It looks like the recent restructuring into an O(N) pass had a regression
(reported in #1695) where deps-of-deps didn't have their build script arguments
propagated upwards. This fixes the caching logic to take into account the
profile as part of the key to ensure that we traverse targets twice if
necessary.

Closes #1695

10 years agoFix propagation of build script args
Alex Crichton [Wed, 10 Jun 2015 02:31:47 +0000 (19:31 -0700)]
Fix propagation of build script args

It looks like the recent restructuring into an O(N) pass had a regression
(reported in #1695) where deps-of-deps didn't have their build script arguments
propagated upwards. This fixes the caching logic to take into account the
profile as part of the key to ensure that we traverse targets twice if
necessary.

Closes #1695

10 years agoHandle missing files after `cargo rustc`
Alex Crichton [Wed, 10 Jun 2015 01:40:50 +0000 (18:40 -0700)]
Handle missing files after `cargo rustc`

Some flags to the compiler could cause it to stop early or not emit some files
altogether (or perhaps emit files in different locations even). Currently cargo
expects a few outputs of the compiler after `cargo rustc` is run, but this
commit alters cargo to know that when `cargo rustc` is being run that the
outputs may not exist and that's ok.

Closes #1675

10 years agoAuto merge of #1697 - alexcrichton:fix-path-pkgid, r=brson
bors [Mon, 8 Jun 2015 22:31:51 +0000 (22:31 +0000)]
Auto merge of #1697 - alexcrichton:fix-path-pkgid, r=brson

The method of creating package ids in Cargo means that all sub-crates of a main
repo have the same package id, which encodes the path it came from. This means
that if the "root crate" switches, the package id for all dependencies will
change, causing an alteration in package id hashes, causing recompiles.

This commit alters a few points of hashing to ensure that whenever a package is
being hashed for freshness the *source root* of the crate is used instead of the
root of the main crate. This cause the hashes to be consistent across compiles,
regardless of the root package.

Closes #1694

10 years agoFix spurious rebuilds when switching source paths
Alex Crichton [Mon, 8 Jun 2015 22:18:38 +0000 (15:18 -0700)]
Fix spurious rebuilds when switching source paths

The method of creating package ids in Cargo means that all sub-crates of a main
repo have the same package id, which encodes the path it came from. This means
that if the "root crate" switches, the package id for all dependencies will
change, causing an alteration in package id hashes, causing recompiles.

This commit alters a few points of hashing to ensure that whenever a package is
being hashed for freshness the *source root* of the crate is used instead of the
root of the main crate. This cause the hashes to be consistent across compiles,
regardless of the root package.

Closes #1694

10 years agoAuto merge of #1693 - durka:patch-1, r=steveklabnik
bors [Mon, 8 Jun 2015 18:56:11 +0000 (18:56 +0000)]
Auto merge of #1693 - durka:patch-1, r=steveklabnik

I was confused by the double-asterisk syntax in the glob. I figured it couldn't hurt to unobtrusively document what the format is.

10 years agodoc: add link to glob::glob::Pattern
Alex Burka [Mon, 8 Jun 2015 18:48:33 +0000 (14:48 -0400)]
doc: add link to glob::glob::Pattern

I was confused by the double-asterisk syntax in the glob. I figured it couldn't hurt to unobtrusively document what the format is.

10 years agoClone less with an extra `Registry` impl
Alex Crichton [Mon, 8 Jun 2015 17:58:15 +0000 (10:58 -0700)]
Clone less with an extra `Registry` impl

10 years agoRemove redundant storage of source id in Package
Alex Crichton [Mon, 8 Jun 2015 17:51:29 +0000 (10:51 -0700)]
Remove redundant storage of source id in Package

The package already has access to the source through the stored manifest's
package ID.

10 years agoAuto merge of #1682 - yoongkang:new_error_msg, r=alexcrichton
bors [Sun, 7 Jun 2015 17:19:35 +0000 (17:19 +0000)]
Auto merge of #1682 - yoongkang:new_error_msg, r=alexcrichton

Some project names caused problems as
they already exist in target/debug. When
the projects fail to be created, the error
message was also not descriptive.

This commit adds a blacklist and a more
descriptive error message.

See #1618.

10 years agoAuto merge of #1687 - huonw:dev-dep-doc-test, r=alexcrichton
bors [Sat, 6 Jun 2015 17:45:12 +0000 (17:45 +0000)]
Auto merge of #1687 - huonw:dev-dep-doc-test, r=alexcrichton

Previously a dependency cycle like `a` <-(normal)- `b` <-(dev)- `a`
would mean that importing `b` in `a`'s doc test would fail because the
original `a` library was not found.

Fixes #1686.

10 years agotest: point doc tests to the main library, for cyclic deps.
Huon Wilson [Sat, 6 Jun 2015 08:22:36 +0000 (18:22 +1000)]
test: point doc tests to the main library, for cyclic deps.

Previously a dependency cycle like `a` <-(normal)- `b` <-(dev)- `a`
would mean that importing `b` in `a`'s doc test would fail because the
original `a` library was not found.

Fixes #1686.

10 years agoBlacklist binary target names
Yoong Kang Lim [Wed, 3 Jun 2015 13:35:44 +0000 (23:35 +1000)]
Blacklist binary target names

Some binary targets caused problems as
the directory names exist in target/debug. When
the compilation step fails, the error
message was also not descriptive.

This commit adds a blacklist and a more
descriptive error message.

See #1618.

10 years agoAuto merge of #1657 - alexcrichton:share-target-dirs, r=brson
bors [Thu, 4 Jun 2015 17:30:58 +0000 (17:30 +0000)]
Auto merge of #1657 - alexcrichton:share-target-dirs, r=brson

This commit adds support to allow specifying a custom output directory to Cargo.
First, the `build.target-dir` configuration key is checked, and failing that the
`CARGO_TARGET_DIR` environment variable is checked, and failing that the root
package's directory joined with the directory name "target" is used.

There are a few caveats to switching target directories, however:

* If the target directory is in the current source tree, and the folder name is
  not called "target", then Cargo may walk the output directory when determining
  whether a tree is fresh.
* If the target directory is not called "target", then Cargo may look inside it
  currently for `Cargo.toml` files to learn about local packages.
* Concurrent usage of Cargo will still result in badness (#354), and this is now
  exascerbated because many Cargo projects can share the same output directory.
* The top-level crate is not cached for future compilations, so if a crate is
  built into directory `foo` and then that crate is later used as a dependency,
  it will be recompiled.

The naming limitations can be overcome in time, but for now it greatly
simplifies the crawling routines and shouldn't have much of a negative impact
other than some Cargo runtimes (which can in turn be negated by following the
"target" name convention).

Closes #482

10 years agoAuto merge of #1685 - mbrubeck:ndebug, r=alexcrichton
bors [Thu, 4 Jun 2015 16:57:24 +0000 (16:57 +0000)]
Auto merge of #1685 - mbrubeck:ndebug, r=alexcrichton

The "ndebug" cfg directive was removed in #1444.

10 years ago[docs] Remove mention of --cfg ndebug
Matt Brubeck [Thu, 4 Jun 2015 16:12:24 +0000 (09:12 -0700)]
[docs] Remove mention of --cfg ndebug

The "ndebug" cfg directive was removed in #1444.

10 years agoAuto merge of #1680 - steveklabnik:gh1679, r=alexcrichton
bors [Wed, 3 Jun 2015 15:29:16 +0000 (15:29 +0000)]
Auto merge of #1680 - steveklabnik:gh1679, r=alexcrichton

Fixes #1679

10 years agoRemove outdated FAQ entry
Steve Klabnik [Wed, 3 Jun 2015 12:15:14 +0000 (08:15 -0400)]
Remove outdated FAQ entry

Fixes #1679

10 years agoAuto merge of #1668 - alexcrichton:perf, r=alexcrichton
bors [Wed, 3 Jun 2015 05:11:43 +0000 (05:11 +0000)]
Auto merge of #1668 - alexcrichton:perf, r=alexcrichton

Playing around with Servo recently I realized that a "noop build" (e.g. `cargo build` had no work to do) took about 5s to complete on my machine! I wasn't super happy with this performance, so I investigated the performance and applied a number of optimizations as part of this PR:

* Primarily, algorithmic changes were made to not traverse the dependency graph too often. There were previously two code paths where each node in the graph would traverse its entire subgraph, causing excessively high runtimes.
* Many minor changes were made to reduce allocations and in general cache results between invocations.
* The Rust version in use was updated to pick up the recent change to look at `DT_DIR` for `DirEntry::file_type`

Overall this PR improves a noop build of Servo from 5s to 0.5s on my machine.

10 years agoUpdate rust-url to improve hash/cmp performance
Alex Crichton [Mon, 1 Jun 2015 21:44:06 +0000 (14:44 -0700)]
Update rust-url to improve hash/cmp performance

Both no longer require allocations!

10 years agoAuto merge of #1678 - chris-morgan:master, r=alexcrichton
bors [Wed, 3 Jun 2015 05:01:01 +0000 (05:01 +0000)]
Auto merge of #1678 - chris-morgan:master, r=alexcrichton

This regression, introduced in d3f590f59ff72f1d3b457ed3716483ce472053c6 in #1674, caused `make` to fail on machines where `python` is Python 3 rather than Python 2, because `dict.keys()` returns a set-like object that does not support indexing rather than a list.

`date = next(iter(snaps.keys()))` would be an adequate fix too, but I’m not particularly happy with either of them, for neither would stand up to the removal of the `break` statement: one is inadequate because dictionaries are unordered collections, the other is inadequate because `current` would refer to the *last* rather than the *first* snapshot in the file.

10 years agoFix snapshot downloading on Python 3
Chris Morgan [Wed, 3 Jun 2015 02:29:55 +0000 (12:29 +1000)]
Fix snapshot downloading on Python 3

This regression, introduced in d3f590f59ff72f1d3b457ed3716483ce472053c6
in #1674, caused `make` to fail on machines where `python` is Python 3
rather than Python 2, because `dict.keys()` returns a set-like object
that does not support indexing rather than a list.

`date = next(iter(snaps.keys()))` would be an adequate fix too, but I’m
not particularly happy with either of them, for neither would stand up
to the removal of the `break` statement: one is inadequate because
dictionaries are unordered collections, the other is inadequate because
`current` would refer to the *last* rather than the *first* snapshot in
the file.

10 years agoCache the canonical URL for a source
Alex Crichton [Mon, 1 Jun 2015 18:40:49 +0000 (11:40 -0700)]
Cache the canonical URL for a source

This avoids reallocating and recalculating it on each call to
SourceIdInner::{eq, hash}, which are called quite often in the backend.

10 years agoOptimize SourceId::cmp a bit
Alex Crichton [Sat, 30 May 2015 02:25:19 +0000 (19:25 -0700)]
Optimize SourceId::cmp a bit

10 years agoOptimize crawl_build_deps to not re-traverse deps
Alex Crichton [Sat, 30 May 2015 01:40:42 +0000 (18:40 -0700)]
Optimize crawl_build_deps to not re-traverse deps

This function previously, for each dependency, traversed the entire dependency
graph. This ended up taking quite a bit of time as a huge amount of hashing was
being done (each of which is somewhat nontrivial). This commit alters the logic
to instead precompute a table of all the native dependencies that each crate
will need, traversing the dependency graph only once instead of repeatedly.

This commit takes a noop build of Servo from 2.1s to 0.4s

10 years agoDon't allocate in PackageId::hash
Alex Crichton [Fri, 29 May 2015 21:19:39 +0000 (14:19 -0700)]
Don't allocate in PackageId::hash

This hash function is called an enormous number of times in `cargo_rustc`, so
optimizing it is fairly important, and it's also quite trivial to not allocate a
string at all (`semver::Version::hash` already does everything we need).

10 years agoUpdate the Rust snapshot used
Alex Crichton [Fri, 29 May 2015 21:17:13 +0000 (14:17 -0700)]
Update the Rust snapshot used

At least one important I/O related perf fix has landed on nightly (reading
`DT_DIR` for `DirEntry::file_type`) and there are a few other assorted bug fixes
which are being picked up.

10 years agoSwitch from a custom MTime to the filetime crate
Alex Crichton [Fri, 29 May 2015 20:49:13 +0000 (13:49 -0700)]
Switch from a custom MTime to the filetime crate

The crate provides the same functionality necessary for Cargo, but it's
maintained elsewhere now.

10 years agoDon't recurse so often in the dependency graph
Alex Crichton [Fri, 29 May 2015 20:35:29 +0000 (13:35 -0700)]
Don't recurse so often in the dependency graph

Prior to this commit the entire dependency tree would be traversed many, many
times as the short circuits weren't applying fast enough. This commit modifies
the recursion to only happen if the target in question was actually compiled.

This commit saw a noop build time for Servo drop from 4.5s to 2.5s.

10 years agoImplement caching among fingerprint resolutions
Alex Crichton [Fri, 29 May 2015 18:22:44 +0000 (11:22 -0700)]
Implement caching among fingerprint resolutions

This commit adds support for caching the resolved value of a fingerprint among
calls to `resolve`. Due to the recursive nature of a fingerprint, it means that
`resolve` is currently executed a very large number of times for packages which
at transitively dependend up on many times. By caching the returned value of a
fingerprint we're able to prevent extraneous calls into the filesystem or
extraneous hashing.

This also adds an `Arc` to share a `Fingerprint` among all its dependencies as
each fingerprint stores a list of fingerprints that it depends on, and if
they're not shared then the cache isn't exactly the most helpful!

For a noop `cargo build` on Servo (e.g. everything was already built), this
decreased Cargo's runtime from 5s to ~4.5s

10 years agoAuto merge of #1674 - wca:add-freebsd-snapshot, r=alexcrichton
bors [Tue, 2 Jun 2015 21:00:35 +0000 (21:00 +0000)]
Auto merge of #1674 - wca:add-freebsd-snapshot, r=alexcrichton

This branch includes a change to dl-snapshot.py that makes it less directly linked to the format of snapshots.txt, and also adds an initial FreeBSD x86_64 cargo snapshot.  The original URL for my snapshot is:

http://people.freebsd.org/~will/public_distfiles/cargo-nightly-x86_64-unknown-freebsd.tar.gz

SHA256: de678e858de5d2923cc206b7aa1cc84ddc67be00748160f66fc9b7325409e7c7

10 years agoRestore the original triple split.
Will Andrews [Tue, 2 Jun 2015 20:40:37 +0000 (14:40 -0600)]
Restore the original triple split.

10 years agoAuto merge of #1664 - IvanUkhov:is-dir, r=alexcrichton
bors [Tue, 2 Jun 2015 20:38:40 +0000 (20:38 +0000)]
Auto merge of #1664 - IvanUkhov:is-dir, r=alexcrichton

The pull request addresses issue #1663. The problem is that `libgit2` [combines][1] `S_IFDIR ` with `S_IFLNK`, and, therefore, the [strict comparison][2] based on `S_ISDIR` rejects directories.

Regards,
Ivan

[1]: https://github.com/libgit2/libgit2/blob/47f37400253210f483d84fb9c2ecf44fb5986849/src/index.c#L308
[2]: https://github.com/rust-lang/cargo/blob/06dbe6555a4a15f5912bbfc841d446dad4d417cc/src/cargo/sources/path.rs#L150

10 years agoAdd initial FreeBSD x86_64 cargo snapshot.
Will Andrews [Tue, 2 Jun 2015 19:56:37 +0000 (13:56 -0600)]
Add initial FreeBSD x86_64 cargo snapshot.

10 years agoMake fewer assumptions about snapshots.txt format.
Will Andrews [Tue, 2 Jun 2015 19:46:27 +0000 (13:46 -0600)]
Make fewer assumptions about snapshots.txt format.

- Read the file into a nested dictionary instead of variables.
- Only apply special cases where they are really needed.
- Apply a transform to the triple argument to get the platform name to
  determine whether there is a snapshot available for it.
- Apply a similar (but slightly different) transform to get the snapshot's
  file name.  It would be better if the file name matched the platform name
  in snapshots.txt, but it's too late for that now (older versions of this
  script will certainly expect the existing name format).

10 years agoFix the detection of directories when listing files using libgit2
Ivan Ukhov [Sat, 30 May 2015 12:48:25 +0000 (08:48 -0400)]
Fix the detection of directories when listing files using libgit2

10 years agotests: add a test for submodule packaging
Ivan Ukhov [Tue, 2 Jun 2015 13:56:44 +0000 (09:56 -0400)]
tests: add a test for submodule packaging

10 years agotests: move Git-related routines to support
Ivan Ukhov [Mon, 1 Jun 2015 21:38:30 +0000 (17:38 -0400)]
tests: move Git-related routines to support

10 years agoAuto merge of #1671 - alexcrichton:osx-more-robust, r=huonw
bors [Tue, 2 Jun 2015 02:32:13 +0000 (02:32 +0000)]
Auto merge of #1671 - alexcrichton:osx-more-robust, r=huonw

Tests are often flaky because the resolution of the OSX filesystem timestamps
appears to be 1s, so we often have to manually sleep for 1s to ensure that
enough time has passed to guarantee that the timestamp is different (used in
freshness calculations).

10 years agoMake a freshness test more robust on OSX
Alex Crichton [Tue, 2 Jun 2015 01:24:57 +0000 (18:24 -0700)]
Make a freshness test more robust on OSX

Tests are often flaky because the resolution of the OSX filesystem timestamps
appears to be 1s, so we often have to manually sleep for 1s to ensure that
enough time has passed to guarantee that the timestamp is different (used in
freshness calculations).

10 years agoAuto merge of #1656 - EduardoBautista:cargo-home-absolute-path, r=alexcrichton
bors [Fri, 29 May 2015 05:54:27 +0000 (05:54 +0000)]
Auto merge of #1656 - EduardoBautista:cargo-home-absolute-path, r=alexcrichton

OK, this should fix https://github.com/rust-lang/cargo/issues/1655.  It worked on my local.  I am not entirely sure how to write a test for this.  Can I get some help and be pointed in the right direction?

10 years agoAuto merge of #1659 - alexcrichton:shorten-paths-on-windows, r=alexcrichton
bors [Fri, 29 May 2015 00:08:40 +0000 (00:08 +0000)]
Auto merge of #1659 - alexcrichton:shorten-paths-on-windows, r=alexcrichton

Unfortunately paths are getting a little too long on Windows and libgit2 is
given us back the error:

      Failed to rename lockfile to 'C:/bot/slave/nightly-dist-cargo-win-gnu-64-64/build/target/x86_64-pc-windows-gnu/debug/cit/test-155/home/.cargo/git/checkouts/meta-dep-27104ee87001fd00/08c585f6f3927118da012a2d682b67a789c35211/.git/objects/pack/pack-ba5fd201f4c1be9792e6d54eef194e6b733ae719.idx': The data area passed to a system call is too small.

Windows isn't always the best at handling long paths, so this commit changes the
location of the `cit` output directory where tests are located as well as
shortening the name of each test's folder to hopefully get the folder sizes a
little under the limit.

I believe this test is only failing on the nightly bots because the folder name
for the nightly bots is longer than the folder name for the auto bots. Hurray!

10 years agoShorten paths in the test runner for windows
Alex Crichton [Fri, 29 May 2015 00:03:48 +0000 (17:03 -0700)]
Shorten paths in the test runner for windows

Unfortunately paths are getting a little too long on Windows and libgit2 is
given us back the error:

      Failed to rename lockfile to 'C:/bot/slave/nightly-dist-cargo-win-gnu-64-64/build/target/x86_64-pc-windows-gnu/debug/cit/test-155/home/.cargo/git/checkouts/meta-dep-27104ee87001fd00/08c585f6f3927118da012a2d682b67a789c35211/.git/objects/pack/pack-ba5fd201f4c1be9792e6d54eef194e6b733ae719.idx': The data area passed to a system call is too small.

Windows isn't always the best at handling long paths, so this commit changes the
location of the `cit` output directory where tests are located as well as
shortening the name of each test's folder to hopefully get the folder sizes a
little under the limit.

I believe this test is only failing on the nightly bots because the folder name
for the nightly bots is longer than the folder name for the auto bots. Hurray!

10 years agoUse absolute path for CARGO_HOME
Eduardo Bautista [Thu, 28 May 2015 20:18:45 +0000 (15:18 -0500)]
Use absolute path for CARGO_HOME

10 years agoAuto merge of #1658 - alexcrichton:debug-windows, r=alexcrichton
bors [Thu, 28 May 2015 22:59:10 +0000 (22:59 +0000)]
Auto merge of #1658 - alexcrichton:debug-windows, r=alexcrichton

This test is failing on the win64 bot, and I'm not 100% sure why, so trying to
get some more info out of it.

10 years agoTry to debug a failing test on the windows bots
Alex Crichton [Thu, 28 May 2015 22:56:42 +0000 (15:56 -0700)]
Try to debug a failing test on the windows bots

This test is failing on the win64 bot, and I'm not 100% sure why, so trying to
get some more info out of it.

10 years agoAllow specifying a custom output directory
Alex Crichton [Thu, 28 May 2015 22:39:20 +0000 (15:39 -0700)]
Allow specifying a custom output directory

This commit adds support to allow specifying a custom output directory to Cargo.
First, the `build.target-dir` configuration key is checked, and failing that the
`CARGO_TARGET_DIR` environment variable is checked, and failing that the root
package's directory joined with the directory name "target" is used.

There are a few caveats to switching target directories, however:

* If the target directory is in the current source tree, and the folder name is
  not called "target", then Cargo may walk the output directory when determining
  whether a tree is fresh.
* If the target directory is not called "target", then Cargo may look inside it
  currently for `Cargo.toml` files to learn about local packages.
* Concurrent usage of Cargo will still result in badness (#354), and this is now
  exascerbated because many Cargo projects can share the same output directory.
* The top-level crate is not cached for future compilations, so if a crate is
  built into directory `foo` and then that crate is later used as a dependency,
  it will be recompiled.

The naming limitations can be overcome in time, but for now it greatly
simplifies the crawling routines and shouldn't have much of a negative impact
other than some Cargo runtimes (which can in turn be negated by following the
"target" name convention).

Closes #482

10 years agoBump Cargo.toml's version to 0.3.0
Alex Crichton [Thu, 28 May 2015 22:39:03 +0000 (15:39 -0700)]
Bump Cargo.toml's version to 0.3.0

10 years agoAuto merge of #1653 - alexcrichton:update-tar, r=alexcrichton
bors [Wed, 27 May 2015 20:14:08 +0000 (20:14 +0000)]
Auto merge of #1653 - alexcrichton:update-tar, r=alexcrichton

Fixes some extraction bugs when unpacking archives.

10 years agoAuto merge of #1654 - alexcrichton:udpate-ssh2-sys, r=alexcrichton
bors [Wed, 27 May 2015 19:35:25 +0000 (19:35 +0000)]
Auto merge of #1654 - alexcrichton:udpate-ssh2-sys, r=alexcrichton

The bots are trying to build something which isn't needed and is failing on
nightlies, so the build script has been updated to not bulid this unnecessary
artifact as part of libssh2

10 years agoAuto merge of #1642 - alexcrichton:opt-fs, r=huonw
bors [Wed, 27 May 2015 19:16:14 +0000 (19:16 +0000)]
Auto merge of #1642 - alexcrichton:opt-fs, r=huonw

Traversing large directory trees can take quite some time, and this commit optimizes a few locations to reduce the number of calls to `fs::metadata`.

10 years agoAuto merge of #1641 - alexcrichton:update-less, r=brson
bors [Wed, 27 May 2015 19:03:50 +0000 (19:03 +0000)]
Auto merge of #1641 - alexcrichton:update-less, r=brson

Updating a path source can be a possibly expensive operation (lots of
directories that need to be traversed), and currently the root path source is
updated three times:

* Once when the root package is initially loaded.
* Again when the first resolution pass happens over a graph.
* Finally a third when the second resolution pass happens over the graph.

This commit pushes through the original `Source` trait object into the
`PackageRegistry` and removes the implicit call to `add_sources`, pushing that
call up to the stack a bit.

10 years agoAuto merge of #1639 - jimmycuadra:jobs-flag-docs, r=wycats
bors [Wed, 27 May 2015 18:51:59 +0000 (18:51 +0000)]
Auto merge of #1639 - jimmycuadra:jobs-flag-docs, r=wycats

Addresses #1591.

I believe this issue only affects `cargo bench` and `cargo test`. If it's applicable to any of the other commands, let me know and I'll amend this.

10 years agoAuto merge of #1637 - dhuseby:bitrig_snapshot, r=alexcrichton
bors [Wed, 27 May 2015 18:41:28 +0000 (18:41 +0000)]
Auto merge of #1637 - dhuseby:bitrig_snapshot, r=alexcrichton

adds the bitrig cargo snapshot.  d/l the tarball from here: http://blog.linuxprogrammer.org/cargo-nightly-x86_64-unknown-bitrig.tar.gz

10 years agoUpdate libssh2-sys's build script
Alex Crichton [Wed, 27 May 2015 18:31:33 +0000 (11:31 -0700)]
Update libssh2-sys's build script

The bots are trying to build something which isn't needed and is failing on
nightlies, so the build script has been updated to not bulid this unnecessary
artifact as part of libssh2

10 years agoAuto merge of #1617 - alexcrichton:fix-kind-after-the-fact, r=brson
bors [Wed, 27 May 2015 18:29:48 +0000 (18:29 +0000)]
Auto merge of #1617 - alexcrichton:fix-kind-after-the-fact, r=brson

The wrong kind was mistakenly used in the case of having a dependency on a
plugin.

Unfortunately I don't know of a great way to test this, so no unit test is included for now.

Closes #1612

10 years agoAuto merge of #1651 - Roysten:master, r=alexcrichton
bors [Tue, 26 May 2015 20:05:48 +0000 (20:05 +0000)]
Auto merge of #1651 - Roysten:master, r=alexcrichton

10 years agofix name escaping issue in Cargo.toml (#1635) and added corresponding
Roy van der Vegt "platypus [Mon, 25 May 2015 14:49:10 +0000 (16:49 +0200)]
fix name escaping issue in Cargo.toml (#1635) and added corresponding
test

10 years agoUpdate the tar-rs dependency
Alex Crichton [Tue, 26 May 2015 17:16:41 +0000 (10:16 -0700)]
Update the tar-rs dependency

Fixes some extraction bugs when unpacking archives.

10 years agoMerge pull request #1640 from alexcrichton/fix-rel-config
Brian Anderson [Fri, 22 May 2015 03:01:39 +0000 (20:01 -0700)]
Merge pull request #1640 from alexcrichton/fix-rel-config

Fix a relative `rustc` spec to .cargo/config

10 years agoReduce calls to fs::metadata in list_git_files
Alex Crichton [Wed, 20 May 2015 06:07:15 +0000 (23:07 -0700)]
Reduce calls to fs::metadata in list_git_files

When walking over entries in the index of a git repository the file type can be
known without a syscall (in the form of a libc constant), but walking over
untracked files still requires a syscall to determine if it's a directory.

10 years agoOptimize the number of calls to fs::metadata
Alex Crichton [Wed, 20 May 2015 06:04:47 +0000 (23:04 -0700)]
Optimize the number of calls to fs::metadata

When iterating over `DirEntry` values the file type of the entry can typically
be determined without a syscall, so use the new unstable APIs in `std::fs` to
avoid an extra call to `fs::metadata`. When traversing large directory trees the
improvement is quite noticeable!

10 years agoDon't update the same path source multiple times
Alex Crichton [Wed, 20 May 2015 05:50:26 +0000 (22:50 -0700)]
Don't update the same path source multiple times

Updating a path source can be a possibly expensive operation (lots of
directories that need to be traversed), and currently the root path source is
updated three times:

* Once when the root package is initially loaded.
* Again when the first resolution pass happens over a graph.
* Finally a third when the second resolution pass happens over the graph.

This commit pushes through the original `Source` trait object into the
`PackageRegistry` and removes the implicit call to `add_sources`, pushing that
call up to the stack a bit.

10 years agoFix a relative `rustc` spec to .cargo/config
Alex Crichton [Wed, 20 May 2015 04:43:41 +0000 (21:43 -0700)]
Fix a relative `rustc` spec to .cargo/config

The paths were mistakenly relative to .cargo/config, not the directory
containing .cargo/config

10 years agoClarify that --jobs doesn't affect parallelism when running the resulting binary.
Jimmy Cuadra [Wed, 20 May 2015 04:06:24 +0000 (21:06 -0700)]
Clarify that --jobs doesn't affect parallelism when running the resulting binary.

10 years agooops forgot to grab the bitrig line
Dave Huseby [Tue, 19 May 2015 22:38:10 +0000 (15:38 -0700)]
oops forgot to grab the bitrig line

10 years agoupdating snapshot scripts to support bitrig
Dave Huseby [Tue, 19 May 2015 22:36:13 +0000 (15:36 -0700)]
updating snapshot scripts to support bitrig

10 years agoadding bitrig cargo snapshot
Dave Huseby [Tue, 19 May 2015 22:06:28 +0000 (15:06 -0700)]
adding bitrig cargo snapshot

10 years agoAuto merge of #1629 - alexcrichton:env-rustc, r=alexcrichton
bors [Tue, 19 May 2015 04:13:45 +0000 (04:13 +0000)]
Auto merge of #1629 - alexcrichton:env-rustc, r=alexcrichton

These commits add two vectors through which the compiler run can be configured:

* A `RUSTC` environment variable
* A `build.rustc` configuration variable in a `.cargo/config` file

10 years agoAdd rustc/rustdoc config keys to Cargo config
Alex Crichton [Mon, 18 May 2015 22:57:17 +0000 (15:57 -0700)]
Add rustc/rustdoc config keys to Cargo config

In addition to global RUSTC/RUSTDOC env vars, this commit recognizes
`build.rustc` and `build.rustdoc` as configuration keys for Cargo to instruct
what tools should be used instead of the default.

Closes #967

10 years agoAuto merge of #1625 - alexcrichton:ignore-dotfile, r=brson
bors [Tue, 19 May 2015 01:03:03 +0000 (01:03 +0000)]
Auto merge of #1625 - alexcrichton:ignore-dotfile, r=brson

Whenever Cargo infers various targets for a project it currently picks up all
files in associated folders, but dotfiles are a common example of files which
editors generate which Cargo should not pick up, so this commit ignores all
dotfiles in the folders that it is looking at.

Closes #1615

10 years agoAuto merge of #1632 - hansjorg:master, r=alexcrichton
bors [Tue, 19 May 2015 00:50:07 +0000 (00:50 +0000)]
Auto merge of #1632 - hansjorg:master, r=alexcrichton

Check for existence of file in dl_path before fetching with curl.
If file exists, compare hash with expected.

Also wrap tarfile.open() in contextlib.closing() to support older
python versions (<= 2.6).

This fixes part of #1525.

10 years agoMake dl-snapshot.py avoid dl'ing existing files
Hans Jørgen Hoel [Mon, 18 May 2015 23:27:29 +0000 (01:27 +0200)]
Make dl-snapshot.py avoid dl'ing existing files

Check for existence of file in dl_path before fetching with curl.
If file exists, compare hash with expected.

Also wrap tarfile.open() in contextlib.closing() to support older
python versions (<= 2.6).

This fixes part of #1525.

10 years agoRemove borrowed pointer in Config
Alex Crichton [Mon, 18 May 2015 22:33:04 +0000 (15:33 -0700)]
Remove borrowed pointer in Config

Not having a lifetime parameter on the ubiquitous Config structure allows a
great deal of other lifetime annotations to be removed and should make dealing
with storage of Config in a structure much easier (only one lifetime to deal
with, not two).

10 years agoRecognize RUSTC/RUSTDOC environment variables
Alex Crichton [Mon, 18 May 2015 21:55:42 +0000 (14:55 -0700)]
Recognize RUSTC/RUSTDOC environment variables

10 years agoAuto merge of #1628 - alexcrichton:update-deps, r=alexcrichton
bors [Mon, 18 May 2015 21:49:39 +0000 (21:49 +0000)]
Auto merge of #1628 - alexcrichton:update-deps, r=alexcrichton

Opt in to nightly features for a few, and update others to get bitrig support